*Required packages
ssc install ftools
ssc install reghdfe
ssc install outreg2

*Set working directory
cd "/path/to/replication"

*Open data
u "data/panel_month_dummies.dta", clear

*Define full set of controls
global FE panelvar timevar b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba

* drop national newspapers / drop individuals 

	su hc_pc_asians_dropnationalmedia if covid2==0 & losing_income_d==0
	local meandv =  round(r(mean), 0.00001)
	di `meandv'
	reghdfe hc_pc_asians_dropnationalmedia covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", replace tex dec(5) ctitle("Source: Drop", "national media") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

	su hc_pc_asians_sourcenotindividual if covid2==0 & losing_income_d==0
	local meandv = round(r(mean), 0.00001)
	reghdfe hc_pc_asians_sourcenotindividual covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Source: Drop", "individuals") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

* non verbal hate crimes / verbal

	su hc_pc_asians_nonverbal if covid2==0 & losing_income_d==0
	local meandv =  round(r(mean), 0.00001)
	reghdfe hc_pc_asians_nonverbal covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Type: Not" "verbal") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

	su hc_pc_asians_verbal if covid2==0 & losing_income_d==0
	local meandv = round(r(mean), 0.00001)
	reghdfe hc_pc_asians_verbal covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Type:", "Verbal") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

	su hc_pc_asians_violent if covid2==0 & losing_income_d==0
	local meandv =  round(r(mean), 0.00001)
	reghdfe hc_pc_asians_violent covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Type: Physical" "Violence") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

* individual or groups / institutions, media

	su hc_pc_asians_attacker_person if covid2==0 & losing_income_d==0
	local meandv =  round(r(mean), 0.00001)
	reghdfe hc_pc_asians_attacker_person covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Attacker:", "Person") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

	su hc_pc_asians_attacker_instit if covid2==0 & losing_income_d==0
	local meandv =  round(r(mean), 0.00001)
	reghdfe hc_pc_asians_attacker_instit covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Attacker:", "Institutions") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

*drop social media 

	su hc_pc_asians_nosocialmedia if covid2==0 & losing_income_d==0
	local meandv = round(r(mean), 0.00001)
	reghdfe hc_pc_asians_nosocialmedia covid2 losing_income_d covid_unemp timevar_losingincome timevar_province, absorb(panelvar timevar  b157.timevar#c.foreign_pop b157.timevar#c.educ_diplba) cluster(panelvar)
	outreg2 using "tableE1.tex", tex dec(5) ctitle("Where: Not", "social media") keep(covid_unemp) nocons label addtext(Mean DV, `meandv')

